Fix hfield transform - #879
Open
conlain-k wants to merge 4 commits into
Open
Conversation
Contributor
|
Hello @conlain-k, Thanks for the contribution. Right now, we don't have the time to review it but we will come back to you around September. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix heightfield contact correction for transformed heightfields
First, thank you to the developers for your hard work on Coal.
I noticed an issue in the witness-point calculations for heightfields and believe I have narrowed down a fix. This may also be related to #654.
Problem
The heightfield-specific
binCorrection()path mixed heightfield-local bin geometry with world-space contact and support points. Existing identity-pose tests did not expose the mismatch. I originally encountered this on version 3.0.1 and reproduced it on thedevelbranch as well.For example, colliding a sphere near the center of a translated flat heightfield returned a witness in its local coordinates, rather than world coordinates:
In this failure path the penetration depth can still be correct, which made the problem easy to miss. Rotated heightfields could also return an incorrectly transformed normal.
Reproduction
The new test case in
hfields.cppcompares a flatHeightField<OBBRSS>with an analytically equivalent box under identity, translated, and translated-and-rotated poses. It checks penetration, both witnesses, and the contact normal using the defaultCollisionRequestsettings.The test fails on
develbefore this change and passes with the fix applied.Fix
This change performs face selection, support mapping, and projection in the heightfield-local frame. It then transforms the corrected witnesses and normal back to world space. The public heightfield API is unchanged.